package com.caipiao.util;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class ThreadPoolFactory
{
	public static ThreadPoolExecutor GetPool(int poolSize)
	{
		BlockingQueue<Runnable> queue = new ArrayBlockingQueue<Runnable>(1);
		
		return new ThreadPoolExecutor(poolSize, poolSize, 10, TimeUnit.MINUTES, queue, new ThreadPoolExecutor.CallerRunsPolicy());
	}
}
